/*
 * UIControl.h
 *
 *  Created on: 2010-3-23
 *      Author: Administrator
 */

#ifndef UICONTROL_H_
#define UICONTROL_H_

#include "IUIControl.h"
#include "UIStyle.h"

class UIControl : public IUIControl
	{
public:
	UIControl();
	virtual ~UIControl();
	
public:
//	virtual TSize GetMinimumSize()
//		{
//		return TSize(0,0);
//		}
	
	virtual TSize GetControlSizeL()
		{
		return TSize(10,10);
		}
public:
	virtual TRect EstimateSize(const UISize& aSize);
	virtual void Layout(TRect rc);
protected:
	void SetRectsWidthAndHeight(const UISize& aSize);
public:
	virtual TBool IsContainer()
		{
		return EFalse;
		}
	
	void* GetInterface(const TDesC& aDes);
protected:
	UIStyle iStyle;
	RPointerArray<IUIControl> iControlArray;
	
	//内容矩形͸߶�
	TRect iContentRect;
	//�����内边框߿�Ŀ�Ⱥ͸߶�
	TRect iRect;
	//外边框������߿�Ŀ�Ⱥ͸߶�
	TRect iOutRect;
	//Border框
	TRect iBorderRect;
	//Padding框
	TRect iPaddingRect;
	
public:
	virtual UIStyle& GetUIStyle();	
	virtual void SetLT(TInt aLeft,TInt aTop);
	virtual void SetContentLT(TInt aLeft,TInt aTop);
	virtual void SetBorderLT(TInt aLeft,TInt aTop);
	virtual void SetInnerLT(TInt aLeft,TInt aTop);
	virtual void SetPaddingLT(TInt aLeft,TInt aTop);
	
	virtual TInt GetWidth() const;
	virtual TInt GetHeight() const;
	virtual TRect GetRect() const;
	virtual TRect GetContentRect() const;
	virtual TRect GetBorderRect() const;
	virtual TRect GetInnerRect() const;
	virtual TRect GetPaddingRect() const;

public:
	virtual void SetPropertyL(const TDesC& aProperty,const TDesC& aValue);
	virtual void SetPropertyL(const TDesC8& aProperty,const TDesC8& aValue);

	};

#endif /* UICONTROL_H_ */
